var Promise = require('bluebird');

module.exports = {
	index: function(req, res){
		
		Promise.join(Classify.update({
	    		key: "key12"
	    	},{
	    		heat: 2 +1
	    	}), Tags.update({
	    		key: "key2"
	    	},{
	    		heat: 1
    	})).spread(function(ce,te){
    		console.log(ce,te);
    		//next();
    	})

		return;
		Classify.create({
			key: "key1" + 2,
			name: "分类一"
		}).then(function(err){
			console.log(err);
			
		})

		res.json({d:1})

	},
	a: function(req, res){



		Article.create({
			key: "key1" +(+new Date),
			title: "test title",
			keyword: "test keyword",
			description: "test description",
			body: "#h1\n 1. baidu",
			classify: "dd"
		}).then(function(err){
			//console.log(err)
			Article.find({}).then(function(data){
				//console.log(data);
				res.json(data);
			})
		})
		

		
	}
}